﻿using ConfExpert.Forms.Base;
using DevTeam;

using System;
namespace ConfExpert.Forms.Depo
{
    public partial class MergeStokKarti : XForm
    {
        public MergeStokKarti()
        {
            InitializeComponent();
        }

        private void MergeStokKarti_Load(object sender, EventArgs e)
        {
            gridView1.Init("GetXleBitenKartlar");
            gridView1.SetCaptions("PRO:KalacakArtikel");
            gridView1.Columns["SilinecekArtikel"].ColumnEdit = RI(Rp.V_Kumas);
            gridView1.MakeColumnInvisible("str");
            gridView1.MakeReadOnly();
            gridView1.AddSummary();
            gridView1.BestFitColumns();

            btnOk.ItemClick += btnOk_ItemClick;
        }

        public string query = string.Empty;
        void btnOk_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            string idxs = "";
            foreach (int rowHandle in gridView1.GetSelectedRows())
                if (rowHandle > -1)
                    idxs += gridView1.GetRowCellValue(rowHandle, "str").ToString() + "; ";

            if (idxs == "" &&
                DevExpress.XtraGrid.GridControl.NewItemRowHandle != gridView1.FocusedRowHandle &&
                DevExpress.XtraGrid.GridControl.AutoFilterRowHandle != gridView1.FocusedRowHandle
                )
                idxs += gridView1.GetFocusedRowCellValue("str").ToString() + "; ";

            query = idxs;
            this.DialogResult = System.Windows.Forms.DialogResult.OK;

        }
    }
}
